package com.yt.base.util.json.tree;

import java.util.*;

// Referenced classes of package com.htsoft.core.json.tree:
//            Children

public class Node {
	public String id;
	public String text;
	public String parentId;
	public String sn;
	public List otherList;
	public Children children;

	public Node() {
		otherList = new ArrayList();
		children = new Children();
	}

	public String toString() {
		StringBuffer result = new StringBuffer((new StringBuilder("{id : '")).append(id).append("', text : '").append(text).append(
				"', expanded : true").toString());
		if (otherList != null && otherList.size() > 0) {
			Map map;
			for (Iterator iterator = otherList.iterator(); iterator.hasNext(); result.append(", ").append(map.get("key")).append(" : '").append(
					map.get("value")).append("'"))
				map = (Map) iterator.next();

		}
		if (children != null && children.getSize() != 0)
			result.append(", children : ").append(children.toString());
		else
			result.append(", leaf : true");
		result.append("}");
		return result.toString();
	}

	public void sortChildren() {
		if (children != null && children.getSize() != 0)
			children.sortChildren();
	}

	public void sortSnChildren() {
		if (children != null && children.getSize() != 0)
			children.sortSnChildren();
	}
}
